package com.mkjb.entity;

import com.mkjb.utils.UuidGenerator;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 角色
 * Created by DingJie on 2017/3/27.
 */
public class Role implements Serializable {
    private String uuid = UuidGenerator.generate();
    private String roleName;
    private List<Permission> permissionList;//一个角色对应多个权限
    private List<User> userList;//一个角色对应多个用户

    public Role() {
    }

    public String getUuid() {
        return uuid;
    }

    public List<Permission> getPermissionList() {
        return permissionList;
    }

    public void setPermissionList(List<Permission> permissionList) {
        this.permissionList = permissionList;
    }

    public List<User> getUserList() {
        return userList;
    }

    public void setUserList(List<User> userList) {
        this.userList = userList;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public String getRoleName() {
        return roleName;
    }

    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }

    public List<String> getPermissionsName() {
        List<String> list = new ArrayList<String>();
        List<Permission> permissionList = getPermissionList();
        for (Permission permission : permissionList) {
            list.add(permission.getPermissionName());
        }
        return list;
    }
}
